package com.example.springboot.mapper;

import com.example.springboot.domain.Collect;
import com.example.springboot.domain.Like;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

@Mapper
@Component(value ="likeMapper")
public interface LikeMapper {
    @Insert("insert into likes (userId,fid,module) values (#{userId},#{fid},#{module})")
    public void insert(Like like);

    @Select("select * from likes where likes.userId = #{userId} and likes.fid = #{fid}")
    public Like selectUserLike(Like like);

    @Delete("delete from likes where fid = #{id}")
    public void deleteById(Integer id);

    @Select("select count(*) from likes where fid = #{fid}")
    public int selectByFidAndModule(@Param("fid") Integer fid, @Param("module") String module);
}
